home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 14
/
Hot Mix 14.iso
/
HTML
/
vendors
/
finesse
/
examples
/
sh
/
nastran_lsf
< prev
next >
Wrap
Text File
|
1996-06-27
|
7KB
|
302 lines
#! /bin/sh
# FINESSEAPPLICATIONKEY sKITl?iQqZZ[q
#
# Create simple front end for nastran jobs
# ----------------------------------------
# ----------------------------------------
#
# Use some NASTRAN Info
#----------------------
TMPFILE=/tmp/nast.$$
NAST_VER="67"
NAST_RC="nast${NAST_VER}rc"
EXE_NAME="NAST${NAST_VER}r2"
memlower=10
timellower=1
memupper=1000
timelupper=1000
# Finesse Initialisation
# ----------------------
. ${FINESSEPATH-/usr/local/finesse}/fsshinit
# Declare input window
# --------------------
yes=Yes
no=No
jidname="Input File"
rcfname="Jobname"
sdiname="Scratch Directory"
naswin="
FsWindow -name naswin
-title LSF-Nastran;
FsSelectionText -label '$jidname:'
-var jid;
FsSelectionText -label '$rcfname:'
-var rcf=$NAST_RC;
FsSeparator -name separator;
FsForm -name form1 -orientation horizontal;
FsForm -name form2 -parent form1;
FsList -label '$sdiname:'
-items '/net/ws1/scr
/net/filesrv1/scr/scr1
/net/filesrv1/scr/scr2
/net/filesrv2/scr/scr1
/net/filesrv2/scr/scr1'
-var sdi=/net/filesrv1/scr/scr1
-parent form2 -nvisible 4;
FsSeparator -parent form2 -line no
-name separator1;
FsText -label 'Total Memory (MB):'
-var mem=50 -parent form2
-name text1 -packing tight;
FsText -label 'Time Limit (Min.)'
-var timel=50 -parent form2
-name text2 -packing tight;
FsSeparator -name midsep -line dashed
-parent form1;
FsForm -name form3 -parent form1;
FsRadio -label 'Delete Scratch:'
-items '$yes $no' -name radio
-var scr=$yes -parent form3;
FsRadio -label 'Notify when job is done:'
-items '$yes $no' -name radio
-var not=$no -parent form3;
FsRadio -label 'Save old files:'
-items '$yes $no' -name radio
-var old=$yes -parent form3;
FsRadio -label Queue -var queue=normal -name radio
-items 'normal priority' -parent form2 ;
FsPushButton -winstat touch -fsbutton info -name infobut
-label 'Information' -parent form3;
FsPushButton -winstat touch -fsbutton dispsc -name infobut
-label 'Show Finesse-Script' -parent form3 ;
FsPushButton -winstat touch -fsbutton dispwin -name infobut
-label 'Show Windowdefinition' -parent form3 ;
FsPushButton -winstat touch -fsbutton dispsh -name infobut
-label 'Display Jobscript' -parent form3 -nrows 4 ;
FsSeparator -name separator;
FsPushButton -winstat touch -fsbutton sub -label 'Submit Job';
FsPushButton -winstat touch -fsbutton stat -label 'Job Status';
FsPushButton -fsbutton exit -label Exit;
"
# Plausibility checks:
# --------------------
# Test filenames. $1: variable; $2: name
# ---------------
testname()
{
if [ ! -z "$1" ] ; then
return 0; # correct
else
mesg="$2 missing..."
return 1; # erroneous
fi
}
# Test Memory
# $1: value; $2: lower limit; $3: upper limit
testmem()
{
if [ -z "$1" ] ; then
mesg="No Memory given..."; return 1;
else
var=`expr $1 : '.*\([^0-9]\).*'`
if [ -z "$var" ] ; then
if [ $1 -lt $2 ] ; then
mesg="$1<$2: Memory too small...";
return 1; fi
if [ $1 -gt $3 ] ; then
mesg="$1>$3: Memory too large...";
return 1; fi
return 0;
else
mesg="Bad memory value..."; return 1;
fi
fi
}
# Test Time
# $1: value; $2: lower limit; $3: upper limit
testtime()
{
if [ -z "$1" ] ; then
mesg="No Time Value specified ..."; return 1;
else
var=`expr $1 : '.*\([^0-9]\).*'`
if [ -z "$var" ] ; then
if [ $1 -lt $2 ] ; then
mesg="$1<$2: Time limit too small...";
return 1; fi
if [ $1 -gt $3 ] ; then
mesg="$1>$3: Time limit too high...";
return 1; fi
return 0;
else
mesg="Bad time value..."; return 1;
fi
fi
}
#
#
genjob()
{
cat << EOT > $TMPFILE
#!/bin/sh
i=0
echo This is a Nastran simulation.
echo $timel Minutes CPU time are requested.
echo $mem Megabytes of memory are requested.
while [ \$i -le 10000 ] ; do
i=\`expr \$i + 1\`
done
echo Job finished.
EOT
chmod 700 $TMPFILE
}
# Begin Finesse dialog, open input window
# ---------------------------------------
Fsopen "$@"
while :
do
Fsdisplay -n naswin -w "$naswin" -m "Nastran Input"
#----------------------------------------------------------
if [ "$fsbutton" = "exit" ] ; then
Fsclose; exit 0; fi
#----------------------------------------------------------
if [ "$fsbutton" = "sub" ] ; then
# Check variables, on error reopen window
#----------------------------------------
until testname "$jid" "$jidname" &&
testname "$rcf" "$rcfname" &&
testname "$sdi" "$sdiname" &&
testmem $mem $memlower $memupper &&
testtime $timel $timellower $timelupper
do
date | Fsecho -i -p beginning
Fsecho Input ERROR : $mesg
echo \\007
Fsdisplay -n naswin -m "$mesg"
if [ "$fsbutton" = "exit" ] ; then
Fsclose; exit 0; fi
done
Fssave
# OK, start job
# -------------
date | Fsecho -i -p beginning
Fsecho "Input is OK. Job is generated..."
genjob
#cat $TMPFILE | bsub -J $rcf -M $mem -c $timel -q $queue -R - 2>&1 | Fsecho -i
rm -f $TMPFILE
fi
#----------------------------------------------------------
if [ "$fsbutton" = "stat" ] ; then
date | Fsecho -i -p beginning
# bjobs 2>&1 | Fsecho -i
fi
#----------------------------------------------------------
if [ "$fsbutton" = "dispsc" ] ; then
date | Fsecho -i -p beginning
Fsecho -p beginning -f $0
fi
#----------------------------------------------------------
if [ "$fsbutton" = "dispsh" ] ; then
date | Fsecho -i -p beginning
genjob
Fsecho -p beginning -f $TMPFILE
fi
#----------------------------------------------------------
if [ "$fsbutton" = "dispwin" ] ; then
Fsecho -p beginning -t '
=========================================================
FINESSE Window definition
=========================================================
'"$naswin"
fi
#----------------------------------------------------------
if [ "$fsbutton" = "info" ] ; then
Fsecho -p beginning -t '
=========================================================
Starting Nastran with LSF and FINESSE
=========================================================
This FINESSE Window is an example for a jobstarter that
can be used to start a CAE application, e.g. NASTRAN.
Usually a CAE job is generated useing all parameters,
that are set by the user in the window of this jobstarter.
In this demo, there is no functionality concerning the
management of your jobflow. This window shows how simple
it is to generate a window and how to use the parameters
set by the user.
The window is defined in the shellscript $0. The calls
fsopen, fsdisplay, fsecho, fssave and fsclose are the only
FINESSE commands.
In this demo, nastran is simulated by a generated shellscript
that consumes CPU-time. The resources memory-Limit
and CPU-limit are used when the job is started into LSF
with the bsub command.
The Jobstatus can be displayed by pressing the Jobstatus
button. In this window jobcontrol is not possible.
'
fi
done
Fsclose